﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DemoQLKhoSX.BusinessLogicLayer;
using DemoQLKhoSX.EntityClasses;


namespace DemoQLKhoSX.PresentationLayer
{
    public partial class FrmNhap : Form
    {
        DataTable tbNhap = new DataTable();
        public FrmNhap()
        {
            InitializeComponent();
            loadcombobox();
            if (tbNhap == null)
                tbNhap = new DataTable();
            tbNhap.Columns.Add("IDNhap",Type.GetType("System.String"));
            tbNhap.Columns.Add("IDThukho", Type.GetType("System.String"));
            tbNhap.Columns.Add("IDNCC", Type.GetType("System.String"));
            tbNhap.Columns.Add("IDHang", Type.GetType("System.String"));
            tbNhap.Columns.Add("Ngaynhap", Type.GetType("System.DateTime"));
            tbNhap.Columns.Add("Soluongnhap", Type.GetType("System.Int32"));
            gdview.DataSource = tbNhap;
        }

        ThuKhoBLO thukho = new ThuKhoBLO();
        NhaCungCapBLO nhacc = new NhaCungCapBLO();
        HangBLO hang = new HangBLO();
        List<ThuKhoEntity> dsthukho;
        List<NhaCungCapEntity> dsnhacc;
        List<HangEntity> dshang;
        void loadcombobox() {
            if (dshang == null)
                dshang = hang.getHang();
            if (dsnhacc == null)
                dsnhacc = nhacc.getNhaCC();
            if (dsthukho == null)
                dsthukho = thukho.getThuKho();
            
            cbidcc.DataSource = dsnhacc; // k lay duc du lieu
            cbidcc.DisplayMember = "TenNCC";
            cbidcc.ValueMember = "IDNCC";

            cbidhang.DataSource = dshang;
            cbidhang.DisplayMember = "Tenhang";
            cbidhang.ValueMember = "IDHang";

            cbidthukho.DataSource = dsthukho;
            cbidthukho.DisplayMember = "Tenthukho";
            cbidthukho.ValueMember = "IDThukho";
                
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {

        }
    }
}
